import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;


public class ReadObject {

	public static void main(String[] args) {
		 try {
			 File  file=new File("c:\\javaprg\\emp.db");
			 FileInputStream fileInputStream=new FileInputStream(file);
			 ObjectInputStream objectInputStream= new ObjectInputStream(fileInputStream);
		Employee employee=(Employee)objectInputStream.readObject(); 
			  
			 System.out.println("EmpId :"+employee.getId());
			 System.out.println("Empl Name:"+employee.getName());
			 fileInputStream.close();
			  //System.out.println("object written successfully");
			  
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	
	}
}
